import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';
import { router } from 'dva';
const { Link } = router;

export default (self) => [
  {
    title: 'ID',
    name: 'id',
    formItem: {
      type: 'hidden',
    }
  },
  {
    title: '名称',
    name: 'name',
    tableItem: {},
    formItem: {rules: []}
  },
  {
    title: '访问地址',
    name: 'path',
    tableItem: {},
    formItem: {rules: []},
  },
  {
    title: '操作',
    tableItem: {
      width: 180,
      render: (text, record) => (
        <DataTable.Oper>
          <Button tooltip="添加子菜单" onClick={e => self.addMenu(record)}>
            <Icon type="plus" />
          </Button>
          <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
            <Icon type="edit" />
          </Button>
          <Button tooltip="删除" onClick={e => self.onDelete(record)}>
            <Icon type="trash" />
          </Button>
          {/*<Button tooltip="跳转到新路由">*/}
          {/*  <Link to={"/crud/detail?id=" + record.id}>*/}
          {/*    <Icon type="LinkOutlined" antd />*/}
          {/*  </Link>*/}
          {/*</Button>*/}
        </DataTable.Oper>
      )
    }
  }
];
